def count_words(filename):
    try:
        with open(filename) as f_ob:
            contest=f_ob.read()
    except FileNotFoundError:
        msg="sorry,this file"+ filename+"does not exist."
        print(msg)
    else:
        words=contest.split()
        print(words)
filename=['cats.py','dog.py','remove.py']
for filename in filename:
    count_words(filename)